package com.uidp.ui;

import com.acsior.sbc.exception.BusinessException;
import com.acsior.wu.bean.MBGeneral;
import com.acsior.wu.bean.MBGeneralEditableObject;
import com.uidp.domain.Groups;
import com.uidp.domain.Modul;
import com.uidp.domain.ModulModulElements;
import com.uidp.uitils.ManagedBeans;

public class MBGroup extends MBGeneralEditableObject<Groups> {

	private ModulModulElements modulMElements;

	private Modul modul;

	public MBGroup() {
		super(Groups.class);

	}

	@Override
	public void initData() {
		try {
			this.modulMElements = new ModulModulElements();
			this.modul = new Modul();
		} catch (BusinessException e) {

		}

	}

	@Override
	protected boolean isValid() {
		// TODO Auto-generated method stub
		return true;
	}

	public String saveGorup() {
		if (isValid()) {
			try {
				getGeneral().getModulElements().store();
				getGeneral().store();
				getModulMElements().setModulElements(
						getGeneral().getModulElements());
				getModulMElements().setModul(getModul());
				getModulMElements().store();

			} catch (BusinessException e) {

			}

		}
		return "";
	}

	/**
	 * @see MBGeneral#getManagedProp()
	 */
	@Override
	protected ManagedBeans getManagedProp() {
		return ManagedBeans.group;
	}

	public String getUniqname() {
		return getGeneral().getUniqname();
	}

	public void setUniqname(String uniqname) {
		getGeneral().setUniqname(uniqname);
	}

	public String getElementname() {
		return getGeneral().getModulElements().getElementname();
	}

	public void setElementname(String elementname) {
		getGeneral().getModulElements().setElementname(elementname);
	}

	public Integer getOrdering() {
		return getGeneral().getModulElements().getOrdering();
	}

	public void setOrdering(Integer ordering) {
		getGeneral().getModulElements().setOrdering(ordering);
	}

	public ModulModulElements getModulMElements() {
		return modulMElements;
	}

	public void setModulMElements(ModulModulElements modulMElements) {
		this.modulMElements = modulMElements;
	}

	public Modul getModul() {
		return modul;
	}

	public void setModul(Modul modul) {
		this.modul = modul;
	}

}
